package com.woniuxy.kaer.tenants.controller;


import cn.hutool.core.bean.BeanUtil;
import com.woniuxy.kaer.commons.util.Result;
import com.woniuxy.kaer.tenants.entity.ApplyAttachments;
import com.woniuxy.kaer.tenants.from.TenantsApplyAttachmentsFrom;
import com.woniuxy.kaer.tenants.param.TenantsApplyAttachmentsParam;
import com.woniuxy.kaer.tenants.service.ApplyAttachmentsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 程诗洋
 * @since 2025年02月17日
 */

@RestController
@RequestMapping("/applyAttachments")
@Api(tags = "商家入驻申请附件接口")
public class ApplyAttachmentsController {
    @Resource
    private ApplyAttachmentsService applyAttachmentsService;
    @ApiOperation("商铺入驻申请附件提交接口")
    @PostMapping("/submitApplyAttachments")
    public Result submitApplyAttachments(@RequestBody TenantsApplyAttachmentsFrom from)throws Exception{
        TenantsApplyAttachmentsParam tenantsApplyAttachmentsParam = BeanUtil.toBean(from, TenantsApplyAttachmentsParam.class);
        applyAttachmentsService.submitApplyAttachments(tenantsApplyAttachmentsParam);
        return Result.succeed("提价申请附件成功",null);
    }
    //查询附件
    @ApiOperation("查询附件接口")
    @GetMapping("/getApplyAttachments")
    public Result getApplyAttachments(Integer settleId)throws Exception{
        ApplyAttachments applyAttachments =applyAttachmentsService.getApplyAttachments(settleId);
        return Result.succeed("查询成功",applyAttachments);
    }

}

